perm filename OPENFI.SAI[S,AIL] blob sn#129881 filedate 1974-11-17 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	SIMPLE INTEGER PROCEDURE OPENFILE(STRING FILNAM,MODES) BEGIN "OPENFILE"
C00004 ENDMK
C⊗;
SIMPLE INTEGER PROCEDURE OPENFILE(STRING FILNAM,MODES); BEGIN "OPENFILE"
COMMENT EMULATION OF TENEX-SAIL RUNTIME, AS FAR AS POSSIBLE;
EXTERNAL INTEGER _SKIP_;
INTEGER CHN,FLAG,R,W,E,T; LABEL BAD;
R←W←E←0;
WHILE T←LOP(MODES) DO
    IF T="R" THEN R←2
    ELSE IF T="W" THEN W←2
    ELSE IF T="E" THEN E←TRUE
    ELSE USERERR(0,1,"OPENFILE: UNSUPPORTED MODE "&T);
IF LENGTH(FILNAM)=0 THEN FILNAM←INCHWL;
IF (CHN←GETCHAN)=-1 THEN GOTO BAD;
FLAG←0; OPEN(CHN,"DSK",'10,R,W,E,FLAG,FLAG); IF FLAG THEN GOTO BAD;
IF W THEN BEGIN ENTER(CHN,FILNAM,FLAG); IF FLAG THEN GOTO BAD END ELSE
IF R THEN BEGIN LOOKUP(CHN,FILNAM,FLAG); IF FLAG THEN GOTO BAD END;
RETURN(CHN);
BAD:	RETURN(_SKIP_←TRUE);
END "OPENFILE";

DEFINE CFILE(A)="RELEASE(A)";